Various computer graphics methods are known for drawing lines on raster computer graphics displays. For example, a well known computationally efficient method named after J. E. Bresenham. In accordance with the Bresenham method lines are drawn on a raster computer graphics display using pixels that are assigned integral coordinates relative to a notional rectangular coordinate system having a horizontal X major axis and having a vertical Y major axis. For each consecutive unit step along the horizontal X major axis, the Bresenham method is used to select a pixel from a respective vertical column of pixels corresponding to that unit step. The Bresenham method is discussed in his seminal paper published in the IBM Systems Journal, Vol. 4, No. 1 (1965), pg. 25-30. Similarly, other well known line drawing methods select pixels based on consecutive unit steps along the horizontal X major axis. The Digital Differential Analyzer (DDA) method is described in "Procedural Elements For Computer Graphics" by David F. Rogers 1985. ISBN:0-07-53534-5. pages 30-34.
Since a raster computer graphics display may show a large number lines, the many lines are advantageously distinguished by drawing lines using complex line styles (also known as a line type). For example, on the raster computer graphics display a first line may be easily distinguished from a second line if the first line is drawn using a first stippled pattern, and the second line is drawn using a second stippled pattern that is different than the first stippled pattern. As another example, the first line may be easily distinguished from the second line if the first line is drawn using a first colored pattern, and the second line is drawn using a second colored pattern that is different than the first colored pattern.
Various computer graphics methods, libraries, primitives, and the like are known for drawing lines with various line styles, line types, stippled patterns, colored patterns, and the like. Appendix A shows illustrative pseudocode for drawing lines with a stippled line style using X window system high performance graphics. Appendix B shows illustrative pseudocode for drawing lines with a stippled line style using OpenGL high performance graphics. In previously known computer graphics methods, as the line is drawn by selecting pixels based on consecutive unit steps along the horizontal X major axis, the unit step is also used to control the style of the line such as it is being drawn.
High performance computer graphics advantageously provide for computer users interacting with lines on a computer display in real time, just as if the lines were physical objects in the real world. For a three dimensional object depicted in isometric view by an arrangement of lines on the raster computer graphics display, a computer user may use computer controls to rotate the depiction in real time, just as the user would rotate physical objects in the real world. Accordingly a user who initiates rotation of such lines unconsciously expects line style patterns to remain identical as they are rotated in real time, just as features of objects in the real world remain identical when they are rotated.
Unfortunately, using previously known real time computer graphics drawing methods, line style patterns appear to shift and change as lines are substantially rotated. Unconsciously, the computer user experiences feelings of annoyance and confusion as the line style patterns appear to shift and change, since this is contrary to the user's expectations. This is particularly true for substantially rotating the depiction of the three dimensional object in real time, since the depiction of the object includes multiple lines and exhibits a distracting shimmering effect as the line style patterns of the lines of the depiction shift and change.
FIG. 1A is an overlay showing lines drawn using real time graphics drawing methods typical of the prior art. For example first line 101 has a complex stippled pattern as follows:
16 pixels-on PA1 16 pixels-off PA1 8 pixels-on PA1 8 pixels-off PA1 16 pixels-on PA1 16 pixels-on PA1 16 pixels-off PA1 8 pixels-on PA1 8 pixels-off PA1 16 pixels-on PA1 16 pixels-on PA1 16 pixels-off PA1 8 pixels-on PA1 8 pixels-off PA1 16 pixels-on
Accordingly, this pattern is repeated as follows along the length of the line:
Therefore, it should be understood that a long section of 32 pixels-on is repeated once per pattern repeat, so as to provide the 16 pixels-on section at the beginning, and then the longer 32 pixels-on sections at the pattern junctions.
As shown in overlay in FIG. 1A, each of seventeen successive substantially rotated versions of the first line include a respective stippled pattern in the substantially rotated versions that is shifted and changed in comparison with the stippled pattern of the first line.
In general, increased shift and change in the stippled pattern correspond to increased rotation. For example, in FIG. 1A increased shift and change is shown in the seventeenth substantially rotated version of the first line, which is rotated approximately forty-five degrees with respect to the horizontal X major axis. It is theorized by the present inventor that root causes of these limitations in the previously known graphics methods are that consecutive unit steps along the horizontal X major axis are used to control the style of the line such as it is being drawn (regardless of the rotation of the substantially rotated versions of the first line), and that drawing of the line style is not corrected based on the rotation.
It is theorized by the present inventor that the amount of change in line segment length between two lines is computed by the equation. EQU cos(a0)-cos(a1)
where a0 is the angle of rotation of a first line (with respect to one of the axis), and a1 is the angle of rotation of a second line (with respect to the axis) that is rotated with respect to the first line.
Thus, for a change from 0 to 2 degrees the change in line segment length is : EQU cos(0)-cos(2)=1.0-0.99939=0.000609
and for a change from 43 to 45 degrees the change in line segment length is :
cos(43)-cos(45)=0.73135-0.7071=0.02424
Accordingly, the percent change in line segment length is related to the angle of rotation, not just the difference in angle. To illustrate this relationship, the change in line segment length is normalized by the change in angle and the result is plotted as versus rotation angle as shown in FIG. 1B. In the limit as the delta, a0-a1, becomes arbitrarily small, this becomes the derivative of the cosine function, which is just the sine function. This is expressed as the following ratio: ##EQU1## as the delta, a0-a1, becomes arbitrarily small.
The present inventor particularly points out that the sine function starts with a function value of 0 at an angle of 0. This is why an insubstantially rotated version of the line near the axis does not result in shifts and changes in the stippled pattern of more than half of a pixel (unless the line is very long). Accordingly a substantially rotated version of the original line is defined as a version of the original line that is rotated by a sufficient amount so that the stippled pattern of the substantially rotated version of the line would have shifted and changed by more than half of a pixel with respect to the original line if the substantially rotated version of the line were drawn using the methods of the prior art, as illustrated for example in FIG. 1A.
What is needed is an efficient method and apparatus for displaying line rotation in real time on the raster computer graphics display so that substantially rotated versions of original lines maintain a complex line style pattern that is identical to a complex line style pattern of the original lines.